/**
* This file is part of OntoApplications (project linked with OntoCompoFramework)
*
* Copyright (C) 2011 -  Christian Brel
*
* @author   Main    Christian Brel
**/
package applications.insurancecard.fc.lib;

import java.util.Observable;

import ontocompo.api.OntoCompoIntrospection;

import org.objectweb.fractal.fraclet.annotations.Component;
import org.objectweb.fractal.fraclet.annotations.Interface;
import org.objectweb.fractal.fraclet.types.Cardinality;

import applications.insurancecard.fc.api.*;

@Component(provides = {@Interface(name = "insurancecardservice", signature = applications.insurancecard.fc.api.InsuranceCardService.class), @Interface(name = "observable", signature = ontocompo.api.Observable.class), @Interface(name = "ontocompointrospection", signature = ontocompo.api.OntoCompoIntrospection.class)})
public class InsuranceCardServiceImpl extends Observable implements InsuranceCardService, ontocompo.api.Observable, OntoCompoIntrospection {

	private int id;
	private String uid;
	private org.objectweb.fractal.api.Component c;

	public InsuranceCardServiceImpl() {
		this.uid = "applications.insurancecard.fc.lib.InsuranceCardServiceImpl";
	}
	
	@Override
	public InsuranceInformation getInsuranceInfos() {
		// TODO Auto-generated method stub
		System.out.println("LE INSURANCE CARD SERVICE TRAVAILLE AVEC L'ENTREE SUIVANTE: " + this.id);
		
		Adress addr = new AdressImpl("FRANCE", "2010 promenade des Anglais", "75000 PARIS");
		ChildInformation child1 = new ChildInformationImpl("DOE", "MARIANA", "female", "2006-01-30, LAMBRES LEZ DOUAI", "0");
		ChildInformation child2 = new ChildInformationImpl("DOE", "CHARLES", "male", "2008-07-29, NICE", "0");
		ChildInformation[] childs = new ChildInformation[] {child1, child2};
		InsuranceInformation ii = new InsuranceInformationImpl(id, "Doe", "John Peter", "1975-12-24", "PARIS", "FRANCE", "1751275056266", "56", "Dr Mabuse", "married", "2009-05-09", addr, childs);
		return ii;
	}

	@Override
	public void setId(int id) {
		// TODO Auto-generated method stub
		this.id = id;
		setChanged();
		notifyObservers();
	}
	
	public void clearChanged() {
		super.clearChanged();
	}
	
	public void setChanged() {
		super.setChanged();
	}

	@Override
	public org.objectweb.fractal.api.Component getFractalComponent() {
		// TODO Auto-generated method stub
		return this.c;
	}

	@Override
	public void setFractalComponent(org.objectweb.fractal.api.Component c) {
		// TODO Auto-generated method stub
		this.c = c;
	}

	@Override
	public String getUid() {
		// TODO Auto-generated method stub
		return this.uid;
	}

	@Override
	public void setUid(String uid) {
		// TODO Auto-generated method stub
		this.uid = uid;
	}
}
